Form1 Common Dialogs Made in VB wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwpww wwwwp wwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww wwwwwwwwwwwwww Form1, mnuDemo &Demo mnuFOpen File &Open mnuFSave File &Save mnuFonts &Fonts mnuPrinter &Printer _ mnuPSetup Printer Setup mnuPDoc Print Doc Setup a mnuColors &Colors mnuSep mnuExit E&xit mnuFonts_Click OldFont Form1 FontName OldFontSize( FontSizei OldFontWeight FontBold OldFontItalic^ FontItalict OldFontStrikethru5 FontStrikethrud OldFontUnderline FontUnderline{ OldForeColor ForeColor{ ChooseFont LogFont Address MemHandle GlobalAlloc GHNDF GlobalLock lStructSize hwndOwner Flags CF_SCREENFONTS CF_EFFECTSd nfonttype SCREEN_FONTTYPE lpLogFont# Resultf hmemcpyB GlobalUnlock GlobalFree FntSize lfHeightn GetDeviceCaps LOGPIXELSY lfFaceName lfWeight lfItalic lfStrikeOutQ lfUnderline rgbColors @ Form_Load( Height Screen7 Width mnuPSetup_Click PrinterDlgG DevMode PD_PRINTSETUP PrintDlg DeleteDC hDevNamesL hDevMode dmDeviceNameK dmOrientation mnuPDoc_Click PD_RETURNIC nFromPage nToPage nMinPage0 nMaxPage nCopies mnuColors_Click ChooseColor ClrArraya wSize lpCustColors RgbResult BackColor CC_RGBINIT< CC_FULLOPEN mnuFOpen_Click OPENFILENAME szFile szFilter OFN_FILEMUSTEXIST OFN_HIDEREADONLY OFN_PATHMUSTEXIST nFilterIndex lpstrFileu nMaxFile lpstrFilter GetOpenFileName nFileOffset nFileExtension mnuFSave_Click NoTitle GetSaveFileName mnuExit_Click mnuDemo_Click mnuPrinter_Click Demo for accessing Win 3.1 Common Dialogs Author: Costas Kitsos, CIS 73667,1755 Revision: 1.00.00, July 4 1992 mnuFonts_Click Save the defaults We need to use GlobalAlloc to provide lpLogFont which is a* pointer to a LogFont structurep make a local copy of the LogFont structureg Free The Memory calculate the font size in points Font: s Height:"s Weight: s Italic: s select the new font print something restore the defaults Form_Load mnuPSetup_Click PrintDlg() returns an hDC, a global handle to hDevNames and another to hDevMode. Delete the ones we don't need Make a local copy of the global block (hDevMode) free the memoryl Printer:s Orientation:s mnuPDoc_Click This is similar to Printer Setup Printer:s From Page:s To Page:s Copies:"s mnuColors_Click Holds Custom Colors Size of Memory Block A global block is allocated to hold a copy of the custom colorsk Fill Custom Colors with White copy custom colors to the global block get ready to call ChooseColorb copy the new custom colors locallyo Free The Memoryo select the new color for the background comment this out if it's distracting print the new custom colors Custom Colort mnuFOpen_Click First Copy the strings to the Global Memory Block use a sub-allocation scheme to avoid overloading the LDT VB Files *.frm;*.bas;*.mak" Text Files *.txt;*.doc" Free The Memory Common Dialogs File Openu You selected: s Path:"s Filename:"s Extension:s mnuFSave_Click This is similar to GetOpenFileName First Copy the strings to the Global Memory Block use a sub-allocation scheme to avoid wearing down the LDT untitled.frm VB Files *.frm;*.bas;*.mak" Text Files *.txt;*.doc" Free The Memory Common Dialogs File Saveu You selected: s Path:"s Filename:"s Extension:s mnuExit_Click